import { createApp } from 'vue'
import MyMessageBox from "./index.vue"
import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css';
import { TenantRelaOV } from '@/api/tenant/types'


export function showMyMessageBox(msg: string, list: TenantRelaOV[] = [], onClick: any) {
	const div = document.createElement('div');
	document.body.appendChild(div)
	//渲染组件
	const app = createApp(MyMessageBox, {   //第二个参数就是传递的属性,
		msg,
		list,
		onClick(msgObj: TenantRelaOV) {
			onClick(() => {
				app.unmount();
				div.remove()
			}, msgObj)
		}
	});
	app.use(ElementPlus)
	app.mount(div)

}